import fetch from '@/utils/fetch'

export function apiGetFactoryList(listQuery) {
  return fetch({
    url: '/api/v1/factory/list',
    method: 'get',
    params: listQuery
  })
}

export function apiGetFactoryById(factoryId) {
  return fetch({
    url: '/api/v1/factory',
    method: 'get',
    params: {
      id: factoryId
    }
  })
}

export function apiAddFactory(factoryDto) {
  return fetch({
    url: '/api/v1/factory',
    method: 'post',
    data: factoryDto
  })
}

export function apiUpdFactory(factoryDto) {
  return fetch({
    url: '/api/v1/factory',
    method: 'put',
    data: factoryDto
  })
}

export function apiDelFactory(factoryId) {
  return fetch({
    url: '/api/v1/factory',
    method: 'delete',
    params: {
      id: factoryId
    }
  })
}

export function apiSupportFactoryList() {
  return fetch({
    url: '/api/v1/factory/support',
    method: 'get'
  })
}

export function apiExport (listQuery) {
  return fetch({
    url: '/api/v1/factory/export',
    method: 'post',
    data: listQuery,
    responseType: 'arraybuffer'
  })
}
